package com.example.config.change.strategy;

import com.alibaba.fastjson.JSON;
import com.poizon.infrastructure.center.config.core.event.strategy.ConfigChangeEventStrategy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Properties;

@Slf4j
@Component
public class TestConfnigChangeStrategy implements ConfigChangeEventStrategy {
    @Override
    public String getChangedProperty(Properties properties) {
        log.info(">自定义配置变更监听器={}", JSON.toJSONString(properties));
        return JSON.toJSONString(properties);
    }

    @Override
    public Boolean support(Properties properties) {
        return true;
    }

    @Override
    public void configChange(Properties properties) {
        String changedProperty = getChangedProperty(properties);
        log.info(">changedProperty={}", changedProperty);
    }
}
